/*
 * author      : 吴中勤
 * date        : 2018/8/24
 * description : TODO
 */

package com.deepexi.adapter.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class AppConfigPrinter {

    private static final Logger logger = LoggerFactory.getLogger(AppConfigPrinter.class);

    @Value("${spring.profiles.active}")
    private String activeProfile;

    @Value("${server.servlet.context-path}")
    private String serverContext;

    @Value("${server.port}")
    private String serverPort;

    @Value("${spring.datasource.url}")
    private String dbUrl;

    @PostConstruct
    public void show() {
        logger.info("runtime configuration" +
                        "\n\t\tactiveProfile = {}" +
                        "\n\t\tserverContext = {}" +
                        "\n\t\tserverPort    = {}" +
                        "\n\t\tdbUrl         = {}" +
                        "\n",
                activeProfile, serverContext, serverPort, dbUrl);
    }

}
